#include "SkyBoxSceneNode.h"
#include "include/ICameraSceneNode.h"

namespace ISNW
{
namespace scene
{
	void SkyBoxSceneNode::onRegisterSceneNode()
	{
		if(scenemanager)
		{
			scenemanager->registernodeforrendering(this,E_RT_SKY);
		}
	}

	void SkyBoxSceneNode::render()
	{
		core::vector3df position = scenemanager->getActiveCamera()->getAbsolutePosition();

		setPosition(position);

		scenemanager->getdriver()->setTransform(video::E_WORLD,AbsoluteTransformation);

		for(u32 i = 0; i < E_SP_COUNT; ++i)
		{
			scenemanager->getdriver()->setmaterial(Materials[i]);

			scenemanager->getdriver()->drawtriangles(Vertices[i],video::STANDAND_VERTEX,4,Indices[i],2);
		}
	}

} // end namespace scene
} // end namespace ISNW